package com.ls.constant;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @ClassName SystemConstants
 * @Description 常量字段
 * @Author YangLei
 * @Date 2019/5/7 11:13
 * @Version 1.0
 **/
public class SystemConstants {

    //========代理配置启动动态读取======

    public static String sfProxystatus;
    public static String sfProxyIP;
    public static String sfProxyPort;

    /**
     * session中存放的用户key
     */
    public static final String SESSION_USER = "session_user";

    /**
     * session中存放的用户角色id
     */
    public static final String SESSION_USER_ROLE_ID = "session_user_role_id";

    /**
     * session中存放的用户角色key
     */
    public static final String SESSION_ID = "session_id";

    /**
     * token 名字
     */
    public static final String SYS_TOKEN = "token";

    /**
     * 系统用户默认密码
     */
    public static final String DEFAULT_PASSWORD = "123456";

    /**
     * 传参不规范,code：400
     */
    public static final Integer PARAM_INCORRECT_CODE = 400;

    /**
     * 成功,code：200
     */
    public static final Integer SUCCESS_CODE = 200;

    /**
     * 服务内部调用失败,code：500
     */
    public static final Integer SERVER_ERROR_CODE = 500;

    /**
     * 操作无记录,code：403
     */
    public static final Integer NO_RECORD_OPERATION = 403;


    /**
     * 错误公共信息
     */
    public static final String SERVER_ERROR_MESSAGE = "error";
    /**
     * 成功公共信息
     */
    public static final String SERVER_SUCCESS_MESSAGE = "success";
    //http请求方式
    public static final String HTTP_METHOD_POST = "POST";
    public static final String HTTP_METHOD_GET = "GET";
    public static final String HTTP_METHOD_PUT = "PUT";
    public static final String HTTP_METHOD_DELETE = "DELETE";

    //http请求类型
    public static final String PARAM_TYPE_QUERY = "query";
    public static final String PARAM_TYPE_BODY = "body";

    public static final String EMPTY_STR = "";
    public static final String FLAG_CITY = "市";

    public static final String STATION_NUMBER_FORMAT = "0000";

    public static final String TEST_VERFICATION_CODE = "8888";
    /**
     * 身份证验证正则
     */
    public static final String IDENTITY_REG = "(^\\d{15}$)|(^\\d{17}(\\d|X)$)";

    /**
     * 电话号码校验(包含手机和座机)
     */
    public static final String PHONE_NUMBER_REGEX = "(\\d{2,5}-\\d{7,8})|(^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$)";

    public static final String SF_NUMBER_REGEX = "[0-9]*";

    /**
     * 座机号码校验
     */
    public static final String LANDLINE_REGEX = "0\\d{2,3}-\\d{7,8}|\\(?0\\d{2,3}[)-]?\\d{7,8}|\\(?0\\d{2,3}[)-]*\\d{7,8}";
    /**
     * 手机号码校验0
     */
    public static final String PHONE_NUMBER_VALID_REGEX = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,1,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$";
    /**
     * 手机号码
     */
    public static final String TEL_NUMBER_REGEX = "^1([38][0-9]|4[579]|5[0-3,5-9]|6[6]|7[0135678]|9[89])\\d{8}$";

    /**
     * yyyy-MM-dd时间格式正则表达式
     */
    public static final String DATE_YYYY_MM_DD_REGEX = "([0-9]{3}[1-9]|[0-9]{2}[1-9][0-9]{1}|[0-9]{1}[1-9][0-9]{2}|[1-9][0-9]{3})-(((0[13578]|1[02])-(0[1-9]|[12][0-9]|3[01]))|((0[469]|11)-(0[1-9]|[12][0-9]|30))|(02-(0[1-9]|[1][0-9]|2[0-8])))";
    /**
     * 时分格式正则 HH:mm
     */
    public static final String DATE_HH_MM_REGEX = "^([01]\\d|2[01234]):([0-5]\\d|60)$";
    /**
     * 车牌号校验regex
     */
    public static final String CAR_NUMBER_REGEX = "([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳]{1})";

    //默认时区
    public static final String DEFAULT_TIMEZONE = "GMT+8";
    //默认时间格式
    public static final String DEFAULT_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";

    public static final String EXCEL_03_FILE_SUFFIX = ".xls";

    public static final String EXCEL_07_FILE_SUFFIX = ".xlsx";

    //逗号
    public static final String COMMA = ",";

    //斜杠
    public static final String SLASH = "/";

    /**
     * BSP返回的XMl中HEAD标签
     */
    public static final String BSP_XML_BODY = "Body";

    /**
     * BSP返回的XMl中BODY标签中的DeliverTmResponse标签
     */
    public static final String DELIVER_TM_RESPONSE = "DeliverTmResponse";

    /**
     * BSP返回的XMl中BODY标签中的DeliverTmResponse标签中的内容DeliverTm标签
     */
    public static final String DELIVER_TM = "DeliverTm";

    /**
     * BSP返回的XMl中BODY标签中的DeliverTmResponse标签中的内容DeliverTm标签中的price内容
     */
    public static final String DELIVER_TM_PRICE = "price";

    /**
     * BSP返回的XMl中HEAD标签
     */
    public static final String BSP_XML_HEAD = "Head";

    /**
     * BSP返回的XMl中ERROR标签
     */
    public static final String BSP_XML_ERROR = "ERROR";

    /**
     * BSP返回的XMl中ERROR标签里边的值
     */
    public static final String BSP_XML_HEAD_CONTENT = "errorContent";

    /**
     * BSP返回的XMl中HEAD的ERR值
     */
    public static final String BSP_XML_HEAD_ERR = "ERR";


    /**
     * BSP返回的XMl 标签中的code
     */
    public static final String BSP_XML_CODE = "code";

    public static final byte BYTE_ZERO = 0;
    public static final byte BYTE_ONE = 1;

    public static final int VALID_FALSE = 0;
    public static final int VALID_TRUE = 1;


    /**
     * 数字常量  无力吐槽
     */
    public static final int INT_0 = 0;
    public static final int INT_1 = 1;
    public static final int INT_2 = 2;
    public static final int INT_3 = 3;
    public static final int INT_6 = 6;


    /**
     * 字符串常量
     */
    public static final String STRING_0 = "0";

    /**
     * 是否判断 否
     */
    public static final int NO = 0;

    /**
     * 是否判断 是
     */
    public static final int YES = 1;
    /**
     * 导入导出EXCEL拓展名
     */
    public static final String EEXCEL_03_FILE_SUFFIX = ".xls";
    /**
     * 验证码key
     */
    public static final String VERIFYCODE = "stationVerifyCode";

    /**
     * h5兑换手机验证码
     */
    public static final String GV_PHONE_VERIFYCODE = "GvPhoneVerifyCode";
    /**
     * 变更订单状态重试次数
     */
    public static final int RETRY_COUNT = 5;

    /**
     * 短信验证码数字位数
     */
    public static final int PHONE_MESSAGE_CAPTCHA_NUM = 6;

    /**
     * 短信验证码 过期时间5分钟
     */
    public static final int PHONE_MESSAGE_CAPTCHA_EXPIRE_TIME = 300;

    /**
     * 密码强度校验正则(密码必须由10-16位大写字母、小写字母、数字组成)
     */
    public static final String PASSWORD_COMPLEX_VERIFY_REGEX = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)[\\s\\S]{10,16}$";


    /**
     * 导入excel 拓展名
     */
    public static final String[] EXCEL_EXPORT_EXTENSION = {"xls", "xlsx"};

    /**
     * 导入门店成员的excel 列数
     */
    public static final int STORE_USER_IMPORT_COLUMN_NUM = 7;

    /**
     * 最大导入列数
     */
    public static final int MAX_IMPORT_NUM = 5000;

    /**
     * H5请求头中的openId参数名
     */
    public static final String SYSTEM_OPEN_ID = "openid";

    public static final int DATE_LENGTH = 10;

    /**
     * 用户常量
     */
    public static class User {

        /**
         * 用户状态 可用
         */
        public static final int USER_STATUS_ENABLE = 1;

        /**
         * 用户状态 禁用
         */
        public static final int USER_STATUS_DISABLE = 2;

    }

    /**
     * 商家常量
     */
    public static class Company {
        /**
         * 启用
         */
        public static final int COMPANY_USE_LOCK_USABLE = 0;

        /**
         * 停用
         */
        public static final int COMPANY_USE_LOCK_DISABLE = 1;

        /**
         * 自动兑换关闭
         */
        public static final int AUTO_CONFIRM_CLOSED = 0;

        /**
         * 自动兑换开启
         */
        public static final int AUTO_CONFIRM_OPENED = 1;

        /**
         * 月结卡一
         */
        public static final String MONTH_ACCOUNT_FIRST = "1";

        /**
         * 月结卡二
         */
        public static final String MONTH_ACCOUNT_SECOND = "2";

        /**
         * 月结卡号其他
         */
        public static final String MONTH_ACCOUNT_OTHER = "3";
        /**
         * 初始化折扣
         */
        public static final String INIT_DISCOUNT="100";
    }

    /**
     * 订单常量
     */
    public static class MallOrder {
        /**
         * 直销
         */
        public static final int SALE_TYPE_DIRECT = 1;

        /**
         * 分销
         */
        public static final int SALE_TYPE_DISTRBUTION = 2;

        /**
         * 未分佣
         */
        public static final int COMMOSSION_STATUS_NO = 0;

        /**
         * 已分佣
         */
        public static final int COMMOSSION_STATUS_YES = 1;


        /**
         * 礼劵
         */
        public static final int ORDER_PRODUCT_TYPE_GIFT_VOUCHER = 1;


        /**
         * 实物商品
         */
        public static final int ORDER_PRODUCT_TYPE_PHYSICAL = 2;

        /**
         * 微信支付
         */
        public static final int PAYMENT_TYPE_WX = 1;

        /**
         * 系统配送方式
         */
        public static final int DELIVERY_TYPE_SYSTEM = 1;

        /**
         * 商家自定义配送方式
         */
        public static final int DELIVERY_TYPE_CUSTOM = 2;


        /**
         * 关闭类型 未付款自动取消
         */
        public static final int CLOST_TYPE_NO_PAY = 1;

        /**
         * 关闭类型 客户取消订单
         */
        public static final int CLOST_TYPE_CUSTOMER_UNDO = 2;

        /**
         * 关闭类型 商家取消订单
         */
        public static final int CLOST_TYPE_COMPANY_UNDO = 3;

        /**
         * 订单商品详情类型  商品规格
         */
        public static final int ORDER_DETAIL_ENTITY_TYPE_SPEC = 1;

        /**
         * 订单商品详情类型  礼劵
         */
        public static final int ORDER_DETAIL_ENTITY_TYPE_GIFT = 2;

        /**
         * 短信发送状态 未发送
         */
        public static final int MESSAGE_STATUS_UNSENT = 2;

        /**
         * 短信发送状态 已发送
         */
        public static final int MESSAGE_STATUS_SENT = 1;

        /**
         * 短信发送状态 发送失败
         */
        public static final int MESSAGE_STATUS_FAIL = 3;

    }

    /**
     * 运费模板常量
     */
    public static class FreightTemplate {
        /**
         * 地区与重量
         */
        public static final int TEMPLATE_TYPE_REGION_AND_WEIGHT = 1;

        /**
         * 仅地区
         */
        public static final int TEMPLATE_TYPE_REGION = 2;
    }

    /**
     * 用户地址常量
     */
    public static class MallMyAddress {
        /**
         * 是默认收货地址
         */
        public static final int DEFAULT_STATUS_YES = 1;

        /**
         * 不是默认收货地址
         */
        public static final int DEFAULT_STATUS_NO = 2;
    }

    /**
     * 礼劵常量
     */
    public static class GiftVoucher {

        /**
         * 可用的
         */
        public static final int GV_VLD_STATE_USEABLE = 0;
        /**
         * 暂停的
         */
        public static final int GV_VLD_STATE_SUSPEND = 1;

        /**
         * 礼劵模式-生成礼劵
         */
        public static final int GIFT_MODEL_GENERATE = 1;

        /**
         * 礼劵模式-绑定礼劵
         */
        public static final int GIFT_MODEL_BINDING = 2;

        /**
         * 礼劵激活状态 未审核
         */
        public static final int AUDIT_STATUS_DANDELION = -1;

        /**
         * 礼劵激活状态 通过
         */
        public static final int AUDIT_STATUS_THROUGH = 1;

        /**
         * 礼劵激活状态 不通过
         */
        public static final int AUDIT_STATUS_NOT_THROUGH = 0;

        /**
         * 标准快递类型
         */
        public static final int STANDARD_EXPRESS_TYPE = 1;

        /**
         * 商家自定义快递类型
         */
        public static final int CUSTOM_EXPRESS_TYPE = 2;

    }

    /**
     * bsp常量
     */
    public static final class Bsp {

        /**
         * 顺丰运单号正则
         */
        public static final String BSP_MAIL_NO_REGEX = "(SF[0-9]{13})|([0-9]{12})";

        /**
         * 快递产品类型
         */
        public static final String EXPRESS_TYPE = "1";

        /**
         * 包裹数
         */
        public static final Integer PARCEL_QUANTITY = 1;

        /**
         * 付款方式 1寄方付
         */
        public static final Integer PAY_METHOD_MAIL = 1;


        /**
         * 下单成功
         */
        public static final int BSP_SUCCESS = 1;

        /**
         * 下单失败
         */
        public static final int BSP_FAIL = 0;

        /**
         * 路由查询类型 1为运单
         */
        public static final String TRACKING_TYPE_WAYBILL = "1";

        /**
         * BSP 三方下单默认重量 1kg
         */
        public static final double BSP_DEFALUT_WEIGHT = 1D;
    }

    /**
     * 上架表常量
     */
    public static final class MallPutaway {
        /**
         * 下架
         */
        public static final int PUTWAY_STATUS_DOWN = 0;

        /**
         * 上架
         */
        public static final int PUTWAY_STATUS_UP = 1;

        /**
         * 商品
         */
        public static final int PUTWAY_TYPE_PRODUCT = 1;

        /**
         * 礼劵
         */
        public static final int PUTWAY_TYPE_GIFT = 2;
    }

    /**
     * 门店表常量
     */
    public static final class StoreInfo {

        /**
         * 默认门店ID
         */
        public static final long DEFAULT_STORE_ID = 0L;

        /**
         * 默认商家住店名称
         */
        public static final String DEFAULT_STORE_NAME = "默认商家";

        /**
         * 门店状态  0 启用
         */
        public static final int USER_LOCK_ENABLE = 0;

        /**
         * 门店状态 禁用
         */
        public static final int USER_LOCK_DISABLE = 1;
    }

    /**
     * 报表信息
     */
    public static final class ReportInfo {
        /**
         * 总计商户数
         */
        public static final String CO_ALL = "report_co_all";
        /**
         * 本月订单总数
         */
        public static final String CURRENT_MONTH_ORDER = "report_current_month_order";
        /**
         * 本月礼券总数
         */
        public static final String CURRENT_MONTH_GIFT = "report_current_month_gift_voucher";
        /**
         * 本月礼券回收数
         */
        public static final String CURRENT_MONTH_GV_RETURN = "report_current_month_gv_return";
        /**
         * 待激活
         */
        public static final String GV_WAIT_ACTION = "report_gv_wait_action";
        /**
         * 已激活
         */
        public static final String GV_ACTIVITYED = "report_gv_activityed";
        /**
         * 已出库
         */
        public static final String GV_USED = "report_gv_used";
        /**
         * 券回收数
         */
        public static final String GV_RETURN = "report_gv_return";
        /**
         * 昨日新增
         */
        public static final String CO_YESTERDAY_NEW_ADD = "report_co_yesterday_new_add";
        /**
         * 本月新增
         */
        public static final String CO_MONTH_NEW_ADD = "report_co_month_new_add";
        /**
         * 各分部订单统计
         */
        public static final String ORDER_BRANCH_TOTAL = "report_order_branch_total";
        /**
         * 订单前10名商户
         */
        public static final String ORDER_TOP_10_COMPANY = "report_order_top_10_company";

    }

    /**
     * 商品出库表常量
     */
    public static class SpecificationOut {

        /**
         * 出库类型 商品
         */
        public static final int OUT_TYPE_GOODS = 1;

        /**
         * 出库类型 礼劵
         */
        public static final int OUT_TYPE_GIFT = 2;
    }
    public static class Activity{
        /**
         * 无效的状态
         */
        public static final int INVALID_STATE=0;
        /**
         * 有效的状态
         */
        public static final int VALID_STATE=1;
        /**
         * 默认的电话号验证码
         */
        public static final String INIT_PHONE_VERIFY="168168";
    }

    /**
     * 付款方式:
     */
    public static class PayMethod {
        /**
         * 1:寄方付月结
         */
        public static final Integer PAY_METHOD_SEND = 1;
        /**
         * 2:收方付
         */
        public static final Integer PAY_METHOD_RECEIVE = 2;
        /**
         * 3:第三方付
         */
        public static final Integer PAY_METHOD_OTHER = 3;
        /**
         * 4:寄方现付
         */
        public static final Integer PAY_METHOD_SEND_CURRENT = 4;
    }

    public static void main(String[] args) {
        String phone = "028-12345678";
        System.out.println(phone.matches(PHONE_NUMBER_REGEX));
        String phone1 = "02812345678";
        System.out.println(phone1.matches(PHONE_NUMBER_REGEX));
        String phone2 = "13012345678";
        System.out.println(phone2.matches(PHONE_NUMBER_REGEX));

        String str = "13012345678";
//        String str = "02812345678";
//        String str = "028-12345678";
        String pattern = "0\\d{2,3}-\\d{7,8}|\\(?0\\d{2,3}[)-]?\\d{7,8}|\\(?0\\d{2,3}[)-]*\\d{7,8}";

        Pattern r = Pattern.compile(pattern);
        Matcher m = r.matcher(str);
        System.out.println(m.matches());


        String str11 = "2017*11-27 11:03:26";
        String longStr = str11.replaceAll("[^\\d|-]+", "");
        System.out.println("字符串=========：" + longStr);

    }

    /**
     * 三方订单配置常量
     */
    public static class GvSenderInfoOther {
        /**
         * 支付方式-月结
         */
        public static int S_PAY_METHOD_MONTH_SETTLEMENT = 1;
        /**
         * 支付方式-到付
         */
        public static int S_PAY_METHOD_MONTH_DELIVERY = 2;

        /**
         * 支付方式-第三方付款
         */
        public static int S_PAY_METHOD_MONTH_THIRD_PARTY = 3;

        /**
         * 不在线支付
         */
        public static final int ONLINE_PAY_STATUS_NO = 0;

        /**
         * 在线支付
         */
        public static final int ONLINE_PAY_STATUS_YES = 1;

    }

    /**
     * 首页推荐商品轮播 常量
     */
    public static class MallIndexCyclic {
        /**
         * 启用
         */
        public static int STATUS_DISABLE = 1;
        /**
         * 禁用
         */
        public static int STATUS_ENABLE = 2;
    }
}
